function linkfield2($field, $value, $fieldinfo) {
        extract($fieldinfo);
        $setting = string2array($setting);
		
		
		$data = <<<EOT

<style type="text/css">
<!--
.content_div{ margin-top:0px; font-size:14px; position:relative}
#search_div{$field}{ position:absolute; top:23px; border:1px solid #dfdfdf; text-align:left; padding:1px; left:0px;*left:0px; width:263px;*width:260px; background-color:#FFF; display:none; font-size:12px;}
#search_div{$field} li{ line-height:24px;cursor:pointer}
#search_div{$field} li a{  padding-left:6px;display:block}
#search_div{$field} li a:hover, #search_div{$field} li:hover{ background-color:#e2eaff}
-->
</style>
<div class="content_div">
	<input type="text" size="41" id="cat_search{$field}" value="{$value}" onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value.replace(' ','') == '') this.value = this.defaultValue;" class='input-text'><input name="info[{$fieldinfo['field']}]" id="{$fieldinfo['field']}" type="text" class='input-text' value="{$value}" size="41"/>
    <ul id="search_div{$field}"></ul>
</div>		
<script type="text/javascript" language="javascript" >
	function setvalue{$field}(title,id)
	{
		var title = title;
		var id = id;
		var type = "{$fieldinfo['insert_type']}";
		if(type == "id")
		{
			$("#{$fieldinfo['field']}").val(id);
		}
		else if(type == "title")
		{
			$("#{$fieldinfo['field']}").val(title);
		}
		else if(type == "title_id")
		{
			$("#{$fieldinfo['field']}").val(title+'|'+id);
		}
		$("#cat_search{$field}").val(title);
		$('#search_div{$field}').hide();
	}
$().ready(
function(){
	$('#cat_search{$field}').keyup(
		function(){
			var value = $("#cat_search{$field}").val();
			var tablename = '{$fieldinfo['table_name']}';
			var select_title = '{$fieldinfo['select_title']}';
			var like_title = '{$fieldinfo['like_title']}';
			var set_title = '{$fieldinfo['set_title']}';
			var set_id = '{$fieldinfo['set_id']}';
			if (value.length > 0){
				$.getJSON('api.php?op=linkfieldajax&act=linkfield_ajax_search', {value: encodeURIComponent(value),table_name: tablename,select_title: select_title,like_title: like_title,set_title: set_title,set_id: set_id}, function(data){
					if (data != null) {
						var str = '';
						$.each(data, function(i,n){
						    str += '<li onclick=\'setvalue{$field}("'+n.{$fieldinfo['set_title']}+'","'+n.{$fieldinfo['set_id']}+'");\'>'+n.{$fieldinfo['set_title']}+'</li>';
						});
						$('#search_div{$field}').html(str);
						$('#search_div{$field}').show();
					} else {
						$('#search_div{$field}').hide();
					}
				});
			} else {
				$('#search_div{$field}').hide();
			}
		}
	);
}
)

//-->
</script>

EOT;
		
		return $data;
	}